switch (1) {
    case 0:
        console.log("不等于")
        break;
    case 2:
        console.log("不等于")
        break
    default:
        console.log("都不行")
        break;
}

// 每个语句结束必须加break
// ________________________________________________________________________________________
// 循环语句
// while(条件为true){执行的代码}
while (i) {};

// do while 语句   先执行一次语句在进行判断  无论如何执行一次
do
    console.log()
while (i)

// for循环 (初始化表达式;条件表达式;更新表达式)
for (var i = 1; i < 10; i++) {}

// for (表达式 in 对象表达式)  遍历数组或者对象的属性

var arr = [1, 2, 3, 4, 5, 76]
var obj = {
    a: 1,
    b: [1, 2, 23, ],
    c: function fun() {},
    d: "22",
    e: NaN
}
var str = "asdadw"
for (a in arr) {
    console.log(arr[a])
}
for (a in obj) {
    console.log(a)
}
for (a in str) {
    console.log(str[a])
}

// for each in 语句 Javascript自定义增强功能

// continue  语句
for (var i = 0; i < 10; i++) {
    if (i % 2 == 0) {
        continue
    }
    console.log(i)
}

// 关于 a++ 和  ++a
var a = 1;
console.log(++a + a++ + ++a + a++)

// 逻辑运算符
// ! 非  取反
// && 与   左边为假不计算右边  
// || 或 左边为真直接取不计算右边

var n = 0 || 1
var n = 0 && 1

var one = 1;
var zero = 0;

function no_swap(a, b) {
    var tmp = a;
    a = b;
    b = tmp
}
no_swap(one, zero)
console.log(one, zero)

function swap(a, b) {
    return [b, a]
}
[one,zero] = swap(one, zero)
console.log(one,zero)

var map = {"avatar":"","food_ratings":[{"food_id":694965364,"rate_name":"意式肉酱面","rating":2,"rating_text":"太差劲了啊","sku_id":312004533102,"tags":["味道一般","包装简陋","价格贵"]}],"order_id":1212057289458478299,"rated_at":"2017-09-18","rating":2,"rating_text":"太差劲了啊","tags":["配送慢"],"time_spent_desc":"40分钟送达","username":"匿名用户"}
console.log(map.food_ratings[0].hasOwnProperty("food_id"))

// hasOwnProperty  判断一个对象里面是否有某种属性
Object.defineProperty(map,"avatar",{
    enumerable:false,
    wrtanle:false,
    configurable:false
})
map.avatar = "123"
delete map.avatar
console.log(map.avatar)
// map.enumerable = false
for(var sss in map){
    console.log(sss)
}var map = {"avatar":"","food_ratings":[{"food_id":694965364,"rate_name":"意式肉酱面","rating":2,"rating_text":"太差劲了啊","sku_id":312004533102,"tags":["味道一般","包装简陋","价格贵"]}],"order_id":1212057289458478299,"rated_at":"2017-09-18","rating":2,"rating_text":"太差劲了啊","tags":["配送慢"],"time_spent_desc":"40分钟送达","username":"匿名用户"}
console.log(map.food_ratings[0].hasOwnProperty("food_id"))

// hasOwnProperty  判断一个对象里面是否有某种属性
Object.defineProperty(map,"avatar",{
    enumerable:false,
    wrtanle:false,
    configurable:false
})
map.avatar = "123"
delete map.avatar
console.log(map.avatar)
// map.enumerable = false
for(var sss in map){
    console.log(sss)
}